#pragma once
#ifndef __G_CONDITION_H__
#define __G_CONDITION_H__

#include <atomic>

#include "GSynchronizer.h"
#include "GCriticalSection.h"
#include "GTypes.h"

namespace GThread
{

	class GConditionVar
	{
	friend class GRWLock;

	protected:
		void*		Variable;
		
	public:
					GConditionVar();
					~GConditionVar();

		bool		IsCreated() const;

		bool		Create();
		void		Release();

		bool		Wake() const;
		bool		WakeAll() const;
		
		GWaitResult	Wait(GCriticalSection* Section, GUInt32 TimeOut = G_TIMEOUT_INFINITE);
	
	};
}

#endif